package vip.liux.front.adapter.web;

import com.fasterxml.jackson.core.type.TypeReference;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import vip.liux.core.utils.JsonUtils;

import java.io.IOException;
import java.util.Map;

@RestController
@RequestMapping("/api/store")
public class StoreController {

    @GetMapping(value = "/data")
    public Map<String, Object> data() throws IOException {
        return JsonUtils.getObjectMapper().readValue(
                ResourceUtils.getFile("classpath:mock/store.json"),
                new TypeReference<Map<String, Object>>() {
                }
        );
    }
}
